package com.ad.pet.common.data;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.Logger;

import java.util.List;


/**
 * Created by z on.
 * Des:
 * Date: 2017/6/1
 */

public abstract class BaseAdapter<T> extends BaseQuickAdapter<T, BaseViewHolder> {
    public BaseAdapter(int layoutResId, List<T> data) {
        super(layoutResId, data);
    }

    public T get(int position) {
        return getData().get(position);
    }

    public int size() {
        return getData() == null ? 0 : getData().size();
    }

    public void removeLast() {
        if (size() == 0) {
            Logger.d("size ==0");
            return;
        }
        int lastIndex = size() - 1;
        remove(lastIndex);
    }
}
